package com.paipai.service;

import com.paipai.dao.RoundMapper;
import com.paipai.entity.Round;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;

@Service
public class RoundService {
    @Autowired
    RoundMapper roundMapper;

    /***
     * 设置订单流拍
     * @param round
     */
    public void deadSale(Round round) {
        round.setState("4");
        //没有给id 修改不了！！
        roundMapper.updateByPrimaryKey(round);
    }

    /***
     * (生成订单后)设置拍卖已结束
     * @param round
     * @param buyerId
     * @param offerPrice
     */
    public void endSale(Round round, Long buyerId, BigDecimal offerPrice) {
        round.setState("3");
        //设置最终买家id
        round.setUserid(buyerId);
        //设置最终成交价
        round.setFinalprice(offerPrice);
        roundMapper.updateByPrimaryKey(round);
    }
}
